# 设备关联摄像头测试
from Lib.base.keywords import KeyWords
from selenium.webdriver.common.by import By
from Lib.common.common_function import *
from Lib.base.page_object.login_page import LonginPage
import uuid
import random


class RelevanceVideoSource(KeyWords):
    url = KeyWords.url + 'worksite/equipment'

    def relevance(self):
        '''
        关联设备
        :return:
        '''
        data = get_data_by_yaml(
            get_path() + r'\Data\element_data\site_manage\device_relevance_video_source\relevance.yaml')
        element_operation(self, data[0]['data'])

    def cancel_relevance(self):
        '''
        关联设备
        :return:
        '''
        data = get_data_by_yaml(
            get_path() + r'\Data\element_data\site_manage\device_relevance_video_source\cancel_relevance.yaml')
        element_operation(self, data[0]['data'])


if __name__ == '__main__':
    try:
        driver = choose_browser()
        L = LonginPage(driver)
        L.login('kobeAdmin002', 'kobe8888')
        case = RelevanceVideoSource(driver)
        case.relevance()
    except Exception as e:
        driver.quit()
        raise e
    else:
        driver.quit()
